var pathname = window.location.pathname;
var lokalizacja=pathname.split("/");
var f2hGetListInJson = function (listName, siteName, fields, callback, query) {
var $ = jQuery;
if (fields == undefined)
fields = ['Title'];
if (query == undefined)
query = "";
var viewFields = "";
$.each(fields, function (k, v) {
viewFields += ""
});
$().SPServices({
operation: "GetListItems",
webURL: siteName,
listName: listName,
async: false,
CAMLViewFields: "" + viewFields + "",
CAMLQuery: query,
CAMLRowLimit: 0,
completefunc: function (data, status) {
var error = $(data.responseXML).find('errorstring').text();
var error_code = $(data.responseXML).find('errorcode').text();
if (error_code == "0x82000006") {
alert("UWAGA. Lista '" + listName + "' nie została znaleziona. Nie można kontynuować.");
}
else if (error_code) {
alert("B£¥D: " + error_code + "\n" + error);
return;
}
var result = [];
//$($.browser.msie ? data.responseText : data.responseXML).find('row').each(function () {
$(data.responseXML).find("z\\:row, row").each(function () {
var item = {};
var row = $(this);
$.each(fields, function (i, name) {
item[name] = row.attr('ows_' + name);
});
result.push(item);
});
if (callback)
callback(result, status);
//console.log('result', result);
}
});
};
jQuery(document).ready(function() {
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
jQuery(".icopdf").text(jQuery(".icopdf").text().capitalize());
jQuery(".icosend").text(jQuery(".icosend").text().capitalize());
jQuery(".icoprint").text(jQuery(".icoprint").text().capitalize());
jQuery("a.btn_search_small").bind("click",function(){
if(jQuery("#szukaj_w2").is(':checked'))
return;
var pathname = window.location.pathname;
var lokalizacja=pathname.split("/");
if(lokalizacja[1].toLowerCase()=='lt')
{
location.href="/LT/search/Puslapiai/default.aspx?k="+jQuery(".search_input_container input").val();
}
if(lokalizacja[1].toLowerCase()=='en')
{
location.href="/en/Search/Pages/default.aspx?k="+jQuery(".search_input_container input").val();
}
});
//wyświetlenie z grupy orlen na innych wersjach językowych
var pathname = window.location.pathname;
var lokalizacja=pathname.split("/");
lok = lokalizacja;
if(lokalizacja[1].toLowerCase()=='en')
{
jQuery(".search_label, a.btn_search_small span").text("search");
jQuery(".grid_2.box_with_right_padding a h2").text("From Orlen Group");
jQuery(".site_options_inner .float_right span, .site_options_inner span").text("Size: ");
jQuery(".float_right a.up").text("Up");
jQuery(".group_sub_label").text("CHOOSE COMPANY");
jQuery(".site_options_inner span").text("Size");
jQuery(".lang-mod A.lt.lang").css("background-position-x", "75px");
}
if(lokalizacja[1].toLowerCase()=='ru')
{
jQuery(".site_options_inner span").text("размер шрифта");
jQuery(".search_label, a.btn_search_small span").text("поиск");
jQuery(".grid_2.box_with_right_padding a h2").text("Из Orlen");
jQuery(".site_options_inner .float_right span, .site_options_inner span").text("размер: ");
}
if(lokalizacja[1].toLowerCase()=='lt')
{
jQuery(".site_options_inner span").text("Dydis");
jQuery(".search_label, a.btn_search_small span").text("Paieška");
jQuery(".grid_2.box_with_right_padding a h2").text("IŠ ORLEN GRUPĖS");
jQuery(".site_options_inner .float_right span, .site_options_inner span").text("Dydis: ");
jQuery(".sightless").html("Svetainė neįgaliesiems");
jQuery(".float_right a.up").text("Į VIRŠŲ");
jQuery(".group_sub_label").text("PASIRINKITE ĮMONĘ");
}
//modal YT
jQuery('.yt_modal_show').bind('mouseenter', function(){
jQuery('.yt_modal').show();
}).bind('mouseleave', function(){
jQuery('.yt_modal').hide();
});
// groups menu
jQuery('a.orlen_group, #group_menu a.group_menu_close').click(function() {
if(jQuery('#group_menu .group_menu_wrapper').is(':visible'))
{
jQuery('#group_menu .group_menu_wrapper').slideUp();
}
else
{
jQuery('#group_menu .group_menu_wrapper').slideDown();
}
});
jQuery('a.orlen_group2, #group_menu2 a.group_menu_close').click(function() {
if(jQuery('#group_menu2 .group_menu_wrapper').is(':visible'))
{
jQuery('#group_menu2 .group_menu_wrapper').slideUp();
}
else
{
jQuery('#group_menu2 .group_menu_wrapper').slideDown();
}
});
//do góry
jQuery('a.up').click(function() {
jQuery('html, body').animate({scrollTop:0});
});
//szukaczka
jQuery('input[name=query]').click(function() {
jQuery(this).val('');
});
jQuery('div.search_trigger').on('mouseenter', function() {
jQuery('.search_modal').show();
jQuery(this).addClass('hovered');
jQuery('.search_modal input').focus();
});
jQuery('.search_modal, div.search_trigger').on('mouseleave', function() {
if(jQuery('.search_modal input').val() === '' || jQuery('.search_modal input').val() === 'Wpisz szukane słowo...'
|| jQuery('.search_modal input').val() === 'Enter a search term ...'
|| jQuery('.search_modal input').val() === 'Įveskite paieškos žodį ...'
|| jQuery('.search_modal input').val() === 'Introduceți un termen de căutare ...'
|| jQuery('.search_modal input').val() === 'Geben Sie einen Suchbegriff ein ...'
)
{
jQuery('.search_modal').hide();
jQuery('div.search_trigger').removeClass('hovered');
}
});
jQuery('.search_modal').on('mouseenter', function() {
jQuery(this).show();
jQuery('div.search_trigger').addClass('hovered');
})
jQuery('div.search_trigger').on('click', function() {
if(jQuery('.search_modal').is(':visible'))
{
jQuery('.search_modal').hide();
jQuery('div.search_trigger').removeClass('hovered');
}
else
{
jQuery('.search_modal').show();
jQuery(this).addClass('hovered');
jQuery('.search_modal input').focus();
}
});
jQuery('a.close_grey').on('click', function() {
jQuery('.search_modal input').val('').focus();
});
jQuery('a.btn_search_small').click(function() {
return false;
});
//bank zdjęć
jQuery('.gallery_photos a').hover(function() {
jQuery(this).find('.gallery_details').fadeIn(100);
}, function() {
jQuery(this).find('.gallery_details').fadeOut(100);
});
jQuery('a.A1, a.A2, a.A3').click(function() {
var clas = (jQuery(this).attr('class'));
jQuery('a.A1, a.A2, a.A3').removeClass('active');
jQuery(this).addClass('active');
var size = 0;
if(clas === 'A1')
{
size = -2;
}
else if(clas === 'A2')
{
size = 0;
}
else if(clas === 'A3')
{
size = 2;
}
jQuery('.middle p, .middle a, .content_site a, .content_site p, .content_site_right_boxes a, .content_site_right_boxes p, .content_site_right_boxes span').each(function(index, el) {
var originalSize = 0;
if(jQuery(el).attr('data-size') === undefined )
{
originalSize = parseInt(jQuery(el).css('font-size'));
jQuery(el).attr('data-size', originalSize+"px");
}
else
{
originalSize = parseInt(jQuery(el).attr('data-size'));
}
if(jQuery(el).attr('class') !== 'read_more' && jQuery(el).attr('class') !== 'sightless')
jQuery(el).css('font-size', (originalSize + size) + 'px');
});
});
jQuery("select[name=filtr]").change(function(){
document.location.href = "#"+jQuery("select[name=filtr]").val();
});
//slider do logosó
setInterval(function hi(){
var elArray = jQuery('#logos').find('.logos_slider');
var currentIndex = elArray.index(jQuery('#logos').find('.logos_slider:visible'));
var maxCount = (elArray.length - 1);
var next = currentIndex + 1;
if(currentIndex === maxCount) next = 0;
jQuery('#logos').find('.logos_slider:visible').fadeOut('normal', function() {
jQuery(elArray[next]).fadeIn();
});
}, 5000);
});
jQuery(window).load(function() {
if( jQuery('div.main_banner').length > 0 && jQuery('#visual').find('#flashHeaderEmbed').length == 0)
{
jQuery(".main_banner").attr("style","overflow:hidden;min-height: 300px;");
jQuery(".main_banner").append (jQuery("#picture").html());
jQuery(".main_banner img").attr("style","display: inline; height: 300px;");
}
});
jQuery(function(){
var pathname = window.location.pathname;
var lokalizacja=pathname.split("/");
if(jQuery.cookie('DlaNiedowidzacych')==1){
jQuery("body").attr("class","amblyopic");
if(lokalizacja[1].toLowerCase()=='pl'){
jQuery(".sightless").html("Wersja standardowa");
}else{
if(lokalizacja[1].toLowerCase()=='en')
jQuery(".sightless").html("Standard website");
if(lokalizacja[1].toLowerCase()=='ru')
jQuery(".sightless").html("Стандартный сайт");
}
}else{
if(lokalizacja[1].toLowerCase()=='pl'){
jQuery(".sightless").html("Dla niedowidzących");
}else{
if(lokalizacja[1].toLowerCase()=='en')
jQuery(".sightless").html("Website for disabled");
if(lokalizacja[1].toLowerCase()=='ru')
jQuery(".sightless").html("Сайт для инвалидов");
}
}
jQuery(".sightless").bind("click",function(){
if(jQuery.cookie('DlaNiedowidzacych')==0){
jQuery("body").addClass("amblyopic");
jQuery.cookie('DlaNiedowidzacych', "1", { expires: 7, path: '/' });
if(lokalizacja[1].toLowerCase()=='pl'){
jQuery(".sightless").html("Wersja standardowa");
}else{
if(lokalizacja[1].toLowerCase()=='en')
jQuery(".sightless").html("Standard website");
if(lokalizacja[1].toLowerCase()=='ru')
jQuery(".sightless").html("Стандартный сайт");
}
}else{
jQuery("body").removeClass("amblyopic");
jQuery.cookie('DlaNiedowidzacych', "0", { expires: 7, path: '/' });
if(lokalizacja[1].toLowerCase()=='pl'){
jQuery(".sightless").html("Dla niedowidzących");
}
if(lokalizacja[1].toLowerCase()=='en')
jQuery(".sightless").html("Website for disabled");
if(lokalizacja[1].toLowerCase()=='ru')
jQuery(".sightless").html("Сайт для инвалидов");
}
});
jQuery(".language").html("English").show();
jQuery(".languagepl").html("Polski").show();
if(jQuery("a.orlen_group").html() == "")
jQuery("a.orlen_group").html('');
jQuery(".group").show();
var pathname = window.location.pathname;
var lokalizacja=pathname.split("/")
if(lokalizacja[1].toLowerCase()=='pl'){
jQuery(".tekstszukaj").attr("value","Wpisz szukane słowo...");
}else{
jQuery(".tekstszukaj").attr("value","Enter a search term ...ss");
}
jQuery("#bottom_menu .main_menu").removeClass("main_menu");
jQuery("#bottom_menu ul ul").hide();
jQuery("#bottom_menu .last").hide();
jQuery("#bottom_menu ").show();
});
function urlExists(url)
{
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
return http.status!=404;
}
jQuery(window).load(function () {
//obsługa xmla z headerami
if( jQuery('div.main_banner').length > 0) {
var isText; // jeżeli nie ma pliku xml nie są widoczne przyciski
var pathname = window.location.pathname;
var site ="";
var lokalizacja=pathname.split("/");
for( var i =0; i < lokalizacja.length -2; i++) // tworzenie adresu bez Strony/Nazwa.aspx
site += lokalizacja[i] + "/";
var text = "";
if ( urlExists(site+"Documents/header.xml")) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", site+"/Documents/header.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
var x = xmlDoc.getElementsByTagName("item");
//Pętla szukania wpisów XML
for (i = 0; i < x.length; i++) {
// var chk =jQuery(x[i]);
// console.log(chk.attr('bgUrl'));
// console.log(x[i].getAttribute('bgURL'));
var thumbUrl ="";
var callToActionURL ="";
var label ="";
if( x[i].getAttribute('thumbUrl') != null)
thumbUrl = " thumbUrl ='"+ x[i].getAttribute('thumbUrl')+"'";
if( x[i].getAttribute('label') != null)
{
label = "title='" + x[i].getAttribute('label');
}
else
isText = false;
if( x[i].getAttribute('callToActionURL') != null && x[i].getAttribute('callToActionURL') !="")
callToActionURL = "href='" + x[i].getAttribute('callToActionURL')+"' ";
text += "";
text += "";
text += "";
var y = x[i].getElementsByTagName("image");
//Pętla szukania dodatkowych obrazów dla danej sekcji
for(j = 0; j < y.length; j++) {
text += "";
//dodanie obrazków bez tytułów, inaczej nivo rozpozna, że ma być controlNav
text += "";
text += "";
}
}
}
else {
text = "";
isText = false;
}
jQuery('div.main_banner').append(text);
jQuery('div.main_banner').nivoSlider({
directionNav: false,
animSpeed: 200,
effect: 'boxRandom',
controlNav: isText
});
}
});
jQuery(function(){
if(lokalizacja[1].toLowerCase()=='de'){
jQuery("UL.main_menu LI.last").attr("style","WIDTH: 155px !important");
}
if(lokalizacja[1].toLowerCase()=='ru'){
jQuery("UL.main_menu LI.last").attr("style","WIDTH: 155px !important");
}
if(lokalizacja[1].toLowerCase()=='ro'){
jQuery("UL.main_menu LI.last").attr("style","WIDTH: 176px !important");
jQuery("UL.main_menu LI.last a").attr("style","max-WIDTH: 139px !important");
}
/*
jQuery(".main_menu > li a").not(".main_menu li ul a").each(function(){
var ciag = jQuery(this).html();
var rozbity = ciag.split(" ");
if (rozbity[0].length > 2 && rozbity[0].length < 11){
var menugot="";
for (i = 0; i < rozbity.length; i++){
menugot = menugot + rozbity[i]+" ";
if(i==0){
menugot = menugot + "
";
}
}
jQuery(this).html(menugot);
}else{
}
});
*/
});